home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Accessor / VectorAccessor.h < prev   
Encoding:
Text File  |  1997-09-11  |  2.8 KB  |  101 lines  |  [TEXT/CWIE]

  1. // VectorAccessor.h
  2. //    Copyright:    © 1994 - 1996-1997 by Apple Computer, Inc., all rights reserved.
  3. // Implements ExactSearch and RankedSearch over VectorIndices
  4.  
  5. #pragma once
  6. #ifndef VectorAccessor_h
  7. #define VectorAccessor_h
  8.  
  9. #pragma import on
  10.  
  11. #include "RankedAccessor.h"
  12. #include "TWVector.h"
  13.  
  14. #pragma IA_BEGIN_EXPORTS
  15.  
  16. class VectorIndex;
  17. class IAQuery;
  18.  
  19. const uint32 VectorAccessorType = 'Vec0';
  20.  
  21. class VectorAccessor : public virtual RankedAccessor {
  22.     friend class VectorScorer;
  23. public:
  24.         VectorAccessor(VectorIndex** indices, uint32 indexCount, uint32 t = VectorAccessorType);
  25.         VectorAccessor(VectorIndex** index_ptr_ptr, TermIndex* context);
  26.         ~VectorAccessor();
  27.  
  28.  
  29.     uint32        RankedSearch(byte*                     textQuery,     uint32     textQueryLen,
  30.                              RankedQueryDoc*         docQuery,     uint32     docQueryLen,
  31.                              RankedHit**            results,    uint32    resultLen,
  32.                              uint32                matchingTermsLen,
  33.                              RankedProgressFn*        progressFn,
  34.                              clock_t                progressFreq,
  35.                              void*                    appData);
  36.                              
  37.     uint32        RankedSearch(IADocText*             textQuery,
  38.                              RankedQueryDoc*         docQuery,     uint32     docQueryLen,
  39.                              RankedHit**            results,    uint32    resultLen,
  40.                              uint32                matchingTermsLen,
  41.                              RankedProgressFn*        progressFn,
  42.                              clock_t                progressFreq,
  43.                              void*                    appData);
  44.  
  45.     uint32        GetDocTopic(RankedQueryDoc*        doc,
  46.                              IATerm**            results,    uint32    resultLen,
  47.                             RankedProgressFn*    progressFn,
  48.                              clock_t                progressFreq,
  49.                              void*                appData);
  50.  
  51.     uint32    GetTermsRelated(byte*             term,     uint32     termLen,
  52.                                  IATerm**            results,    uint32    resultLen,
  53.                                 RankedProgressFn*    progressFn,
  54.                                  clock_t                progressFreq,
  55.                                  void*                appData);
  56.  
  57.     // returns the vector for a doc from the Nth index of this accessor
  58.     TWVector*        GetTWVector(IADoc* doc, uint32 index);
  59. protected:
  60.     void            Initializing();
  61.  
  62.     IABlockSize        InitsSize();
  63.     void            StoringInits(IAOutputBlock* output);
  64.     void            RestoringInits(IAInputBlock* input);
  65.  
  66.     virtual void    CacheTermStats(TermInfo** infos);
  67.  
  68.     float            TermScaleFactor(uint32 index, TermID termID) {
  69.                         return TermScaleFactor(termScaleFactors[index], termID);
  70.                     }
  71.     float            TermScaleFactor(byte* scaleFactors, TermID termID) {
  72.                         return scaleFactorDecoder[scaleFactors[termID]];
  73.                     }
  74. private:
  75.     byte**            termScaleFactors;
  76.     float*            scaleFactorDecoder;
  77.     byte*            scaleFactorEncoder;
  78.     float            scaleFactorEncodingFactor;
  79.     
  80.     void            MakeScaleFactorCodec();
  81.     inline byte        EncodeScaleFactor(TermFreq docCount);
  82.     inline byte        EncodeScaleFactorInternal(TermFreq docCount);
  83.     void            MergeTermInfos();
  84.  
  85.     IAIndex**        UpcastIndices(VectorIndex** is, uint32 n);
  86.                     VectorAccessor(VectorAccessor&);
  87.                     
  88.     uint32        GetDocTopicInternal(RankedQueryDoc*        doc,
  89.                              TWVector**            results,
  90.                             RankedProgressFn*    progressFn,
  91.                              clock_t                progressFreq,
  92.                              void*                appData);
  93.  
  94. };
  95.  
  96. #pragma IA_END_EXPORTS
  97.  
  98. #pragma import reset
  99.  
  100. #endif
  101.